package com.example.boot_mq_topic_produce.com.mmall;

import org.apache.activemq.command.ActiveMQTempQueue;

import org.apache.activemq.command.ActiveMQTopic;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import javax.jms.Queue;
import javax.jms.Topic;

/**
 * @ClassName ConfigBean
 * @Description TODO
 * @Author wushaopei
 * @Date 2019/12/25 16:22
 * @Version 1.0
 */
@Component
public class ConfigBean {

    @Value("${mytopic}")
    private String topicName;

    @Bean
    public Topic topic(){
        return  new ActiveMQTopic(topicName);
    }

    @Bean
    public Queue queue(){
        return  new ActiveMQTempQueue(topicName);
    }

}
